import { cmsRequest } from '@/request'

// ----- 用户管理相关接口 start
export const fetchUserList = (payload: any) => {
  return cmsRequest.post('/plant/user/queryList', payload)
}

export const fetchEnableUser = (payload: any) => {
  return cmsRequest.post('/plant/user/enable', payload)
}

export const fetchChooseRoleList = (payload: any) => {
  return cmsRequest.post('/plant/user/chooseRole', payload)
}

export const createOrUpdateUser = (payload: any) => {
  return cmsRequest.post('/plant/user/createOrUpdateUser', payload)
}

// ----- 用户管理相关接口 end

// ----- 角色管理相关接口 start
export const fetchRoleList = (payload: any) => {
  return cmsRequest.post('/plant/role/query', payload)
}

export const fetchRoleMenus = (payload: any) => {
  return cmsRequest.post('/plant/role/roleMenus', payload)
}

export const fetchRoleDetails = (payload: any) => {
  return cmsRequest.post('/plant/role/getRoleDetails', payload)
}

export const createOrUpdateRole = (payload: any) => {
  return cmsRequest.post('/plant/role/createOrUpdateRole', payload)
}

export const deleteRole = (id: any) => {
  return cmsRequest.delete( `/plant/role/${id}`)
}
// ----- 角色管理相关接口 end